﻿global using Microsoft.Extensions.Logging;

namespace LogNet6;
public class Logger : ILogger
{

    private readonly string _CategoryName;
    private readonly ILoggerProcessor _Proccessor;
    public Logger(string categoryName, ILoggerProcessor processor)
    {
        _CategoryName = categoryName;
        _Proccessor = processor;
    }
    public IDisposable BeginScope<TState>(TState state) => default!;
    public bool IsEnabled(LogLevel logLevel) => true;

    public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
    {
        _Proccessor.AddLog(new(_CategoryName, logLevel, eventId, formatter(state, exception)));
    }
}